#! /bin/sh

export PATH=/opt/kde3/bin:$PATH
opwd=$PWD
tdir=`mktemp -d`
cd $tdir || exit 1
svn export svn+ssh://svn.kde.org/home/kde/trunk/icecream
rm icecream/suse/update_rpm
version=`grep INIT_AUTOMAKE icecream/configure.in  | cut -d, -f2 | sed -e 's,[^"]*",,; s,".*,,'`
tar -cvj -f $opwd/icecc-$version.tar.bz2 icecream
sed -e "s,Version:.*,Version:$version," icecream/suse/icecream.spec.in > $opwd/icecream.spec
mkdir mans
omans=$PWD/mans
cd icecream/doc
for i in *.docbook; do
	output=${i/man-/}
	output=${output/.docbook/}
	meinproc4 --stylesheet /opt/kde3/share/apps/ksgmltools2/customization/kde-man.xsl $i && mv manpage.troff $omans/$output
done
cd ../..
tar cvjf $opwd/icecream-manpages.tar.bz2 mans
cd /
rm -rf $tdir
